package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConParkGloryFeedback;
import com.htgd.gardenexpo.dao.GeConParkGloryFeedbackDao;
import com.htgd.gardenexpo.service.GeConParkGloryFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConParkGloryFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 09:58:56
 */
@Service("geConParkGloryFeedbackService")
public class GeConParkGloryFeedbackServiceImpl implements GeConParkGloryFeedbackService {
    @Resource
    private GeConParkGloryFeedbackDao geConParkGloryFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConParkGloryFeedback queryById() {
        return this.geConParkGloryFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConParkGloryFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConParkGloryFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConParkGloryFeedback> getinfoByGloryId(int id) {
        return this.geConParkGloryFeedbackDao.getinfoByGloryId(id);
    }

    /**
     * 新增数据
     *
     * @param geConParkGloryFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkGloryFeedback insert(GeConParkGloryFeedback geConParkGloryFeedback) {
        this.geConParkGloryFeedbackDao.insert(geConParkGloryFeedback);
        return geConParkGloryFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConParkGloryFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkGloryFeedback update(GeConParkGloryFeedback geConParkGloryFeedback) {
        this.geConParkGloryFeedbackDao.update(geConParkGloryFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConParkGloryFeedbackDao.deleteById() > 0;
    }

    @Override
    public boolean deleteByGloryId(int id) {
        return this.geConParkGloryFeedbackDao.deleteByGloryId(id) > 0;
    }
}
